package flown.math;

public class Vector3
{
    public float x;
    public float y;
    public float z;

    public Vector3() { this(0, 0, 0); }
    public Vector3(float x, float y, float z)
    {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    /**
     * 做加法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector3 Plus(Vector3 v1,Vector3 v2)
    {
        return new Vector3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
    }

    /**
     * 做减法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector3 Minus(Vector3 v1,Vector3 v2)
    {
        return new Vector3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
    }

    /**
     * 做乘法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector3 Time(Vector3 v1,Vector3 v2)
    {
        return new Vector3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z);
    }

    /**
     * 做除法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector3 Divided(Vector3 v1,Vector3 v2)
    {
        return new Vector3(v1.x / v2.x, v1.y / v2.y, v1.z / v2.z);
    }
}
